<?php include _include(ADMIN_PATH.'view/htm/header.inc.htm');?>

<!--{hook admin_system_map_start.htm}-->
<div class="container-fluid px-0">
<div class="row">
	<div class="col-lg-12">
		<!--{hook admin_system_map_middle.htm}-->
		<div class="card card-threadlist">
			<div class="card-body">
                <!--{hook admin_system_map_form_start.htm}-->
                <form action="<?php echo url('other-map'); ?>" method="post" id="form">
                    <?php echo $input['safe_token'];?>
                    <!--{hook admin_system_map_form_before.htm}-->
                    <div class="form-group row">
                        <label class="col-3 col-sm-2 form-control-label"><?php echo lang('map_folder');?></label>
                        <div class="col-9 col-sm-10">
                            <?php echo $input['map']; ?>
                            <p class="small text-muted my-3">
                                <?php echo lang('setting_map_tips');?>
                            </p>
                        </div>
                    </div>
                    <!--{hook admin_system_map_form_after.htm}-->
                    <div class="form-group text-center mt-4">
                        <!--{hook admin_system_map_submit_before.htm}-->
                        <button type="submit" class="btn btn-primary btn-block col-md-3 mx-auto" id="submit" data-loading-text="<?php echo lang('submiting');?>..."> <?php echo lang('submit');?> </button>
                        <!--{hook admin_system_map_submit_after.htm}-->
                    </div>
                    <!--{hook admin_system_map_after.htm}-->
                </form>
                <!--{hook admin_system_map_form_end.htm}-->
                <a role="button" class="btn btn-primary btn-block col-md-3 mx-auto mb-3 sitemap" href="javascript:void(0);"><?php echo lang('map_create');?></a>
                <!--{hook admin_system_map_button_after.htm}-->
                <?php if (!empty($arr)) { ?>
                <ul class="list-unstyled threadlist">
                    <?php foreach ($arr as $file) { ?>
                    <li class="thread py-2">
                        <?php echo $file; ?>
                    </li>
                    <?php } ?>
                </ul>
                <div class="row">
                    <div class="col-lg-12">
                        robots.txt 添加 Sitemap:<?php echo url_prefix() . '/' . array_value($setting, 'map');?>/index.xml
                    </div>
                </div>
                <?php } ?>
			</div>
		</div>
	</div>
</div>
</div>
<!--{hook admin_system_map_end.htm}-->

<?php include _include(ADMIN_PATH.'view/htm/footer.inc.htm');?>

<script>
    var jform = $('#form');
    jform.on('submit', function() {
        jform.reset();
        var jthis = $(this);
        var jsubmit = jthis.find('#submit');
        jsubmit.button('loading');
        var postdata = jform.serializeObject();
        postdata.type = 1;
        $.xpost(jform.attr('action'), postdata, function(code, message) {
            if(code == 0) {
                $.alert(message);
                setTimeout(function() {
                    window.location.reload();
                }, 1000);
            } else if(xn.is_number(code)) {
                $.alert(message);
                jsubmit.button('reset');
            } else {
                jform.find('[name="'+code+'"]').alert(message).focus();
                jsubmit.button('reset');
            }
        });
        return false;
    });

    $('a.sitemap').on('click', function() {
        window.location = xn.url('other-map') + '?type=1';
        return false;
    });

    $('#other').addClass('show');
    $('.sidebar-sticky li.menu-map').addClass('active').prepend('<div class="arrow-tips float-right d-none d-md-block"></div>');
</script>

<!--{hook admin_system_map_js.htm}-->